package org.ayatsuji.startactivitybestpractice;

import android.content.Context;
import android.content.Intent;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;

public class SecondActivity extends AppCompatActivity {

    public static void startAction(Context context, String title) {
        Intent intent = new Intent(context, SecondActivity.class);
        intent.putExtra("title", title);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);

        String title = getIntent().getStringExtra("title");
        ((TextView) findViewById(R.id.second_text)).setText(title);
    }
}